#import <UIKit/UIKit.h>

#import "framework/FWDBAccess.h"

#import "PITask.h"

typedef enum {
    PITaskModeToodledo = 0,
    PITaskModeGTD = 1,
    PITaskModeFC = 2
} PITaskMode;


@class SBApplication;
@class FWApplication;
@class PIRecurrance;


extern NSString* const PIIntegrationContextPasteboard;
extern NSString* const PIContextFieldNameTitle; 
extern NSString* const PIContextFieldNameKey; 

extern NSString* const PIiPhoneIdentifier;
extern NSString* const PIiPadIdentifier;
extern NSString* const PI2iPhoneIdentifier;

extern NSString* const kPIEntityTypeTask;
extern NSString* const kPIEntityTypeTaskTemplate;
extern NSString* const kPIEntityTypeEvent;
extern NSString* const kPIEntityTypeEventOccurance; 
extern NSString* const kPIEntityTypeEventException; 
extern NSString* const kPIEntityTypeEventTemplate;
extern NSString* const kPIEntityTypeAttendee;
extern NSString* const kPIEntityTypeContext;
extern NSString* const kPIEntityTypeProject;
extern NSString* const kPIEntityTypeProjectInternal;
extern NSString* const kPIEntityTypeTag;
extern NSString* const kPIEntityTypeTagInternal;
extern NSString* const kPIEntityTypeNote;
extern NSString* const kPIEntityTypeCalendar;
extern NSString* const kPIEntityTypeCalendarInternal;

extern NSInteger const kPIEntityIDInternalTaskCalendar;
extern NSInteger const kPIEntityIDInternalNotesCalendar;


@interface PIIntegration : NSObject <FWDBAccessDelegate>

+ (NSString*)iconFileForAction:(int)action;
+ (NSString*)iconPathForAction:(int)action application:(FWApplication*)application;

+ (NSString*)iconPathForSmallFlag:(FWApplication*)application;
+ (NSString*)iconPathForLargeFlag:(FWApplication*)application;

+ (NSString*)iconPathForParent:(FWApplication*)application;
+ (NSString*)iconPathForChild:(FWApplication*)application;

+ (NSString*)iconPathForRepeat:(FWApplication*)application;
+ (NSString*)iconPathForAttendees:(FWApplication*)application;
+ (NSString*)iconPathForReminder:(FWApplication*)application;

+ (NSString*)nameForAction:(PIActionType)action;
+ (NSString*)nameForImportance:(PIImportanceType)importance;

+ (UIColor*)colorForAction:(int)action application:(FWApplication*)application;
+ (UIColor*)colorBGForAction:(int)action application:(FWApplication*)application;
+ (UIColor*)colorForImportance:(int)importance application:(FWApplication*)application;
+ (UIColor*)colorBGForImportance:(int)importance application:(FWApplication*)application;
+ (UIColor*)colorForOverdue:(FWApplication*)application;

+ (void)updateInfoFromPrefs:(NSDictionary*)prefs application:(FWApplication*)application;

+ (BOOL)locationMonitoringForPrefs:(NSDictionary*)prefs;

+ (NSArray*)locationContextsFromPI;

+ (NSString*)stringForTitle:(NSString*)title withIcon:(NSString*)icon withProjectIcon:(NSString*)projectIcon;

+ (NSURL*)alarmSoundURL:(FWApplication*)application alarm:(NSString*)alarm;

+ (NSArray*)arrayOfCalendars:(FWApplication*)application includeNative:(BOOL)native includeInternal:(BOOL)internal;
+ (NSArray*)arrayOfTags:(FWApplication*)application keys:(NSArray*)keys;
+ (NSArray*)arrayOfTags:(FWApplication*)application keys:(NSArray*)keys database:(FWDatabase*)database;

+ (PITaskMode)taskMode:(FWApplication*)application;

+ (PIRecurrance*)recurrenceWithFrequency:(NSInteger)type interval:(NSInteger)interval daysOfTheWeek:(NSArray*)daysOfWeek daysOfTheMonth:(NSArray*)daysOfMonth monthsOfTheYear:(NSArray*)monthsOfYear occurances:(NSInteger)occurances endDate:(NSDate*)endDate fromDate:(PIRecurranceFromDateType)fromDate;

@end
